with v8.Class_String;
package v8.Class_CPU_Profile_Node is
   type CPU_Profile_Node (<>) is tagged limited private;
   type Pointer is access all CPU_Profile_Node;
   type Readonly_Pointer is access constant CPU_Profile_Node;
   -- represents a node in a call graph.

   function Get_Function_Name (this : CPU_Profile_Node) return v8.Class_String.Pointer;
   -- Returns function name (empty string for anonymous functions.) (return Handle<String>)

   function Get_Script_Resource_Name (this : CPU_Profile_Node) return v8.Class_String.Pointer;
   --  Returns resource name for script from where the function originates. (return Handle<String>)

   function Get_Line_Number (this : CPU_Profile_Node) return int;
   -- Returns the number, 1-based, of the line where the function originates.
   -- kNoLineNumberInfo if no line number information is available.

   function Get_Total_Time (this : CPU_Profile_Node) return double;
   -- Returns total (self + children) execution time of the function,
   -- in milliseconds, estimated by samples count.

   function Get_Self_Time (this : CPU_Profile_Node) return double;
   -- Returns self execution time of the function, in milliseconds,
   -- estimated by samples count.

   function Get_Total_Samples_Count (this : CPU_Profile_Node) return double;
   --  Returns the count of samples where function exists.

   function Get_Self_Samples_Count (this : CPU_Profile_Node) return double;
   -- Returns the count of samples where function was currently executing.

   function Get_Call_Uid (this : CPU_Profile_Node) return unsigned;
   -- Returns function entry UID.

   function Get_Children_Count (this : CPU_Profile_Node) return int;
   -- Returns child nodes count of the node.

   function Get_Child (this : CPU_Profile_Node; index : int) return Pointer;
   -- Retrieves a child node by index.

   k_No_Line_Number_Info : aliased constant int;
   -- => Message::kNoLineNumberInf

private
   type CPU_Profile_Node is tagged limited null record;

   pragma Import (CPP, Get_Function_Name, "_ZNK2v814CpuProfileNode15GetFunctionNameEv");
   pragma Import (CPP, Get_Script_Resource_Name, "_ZNK2v814CpuProfileNode21GetScriptResourceNameEv");
   pragma Import (CPP, Get_Line_Number, "_ZNK2v814CpuProfileNode13GetLineNumberEv");
   pragma Import (CPP, Get_Total_Time, "_ZNK2v814CpuProfileNode12GetTotalTimeEv");
   pragma Import (CPP, Get_Self_Time, "_ZNK2v814CpuProfileNode11GetSelfTimeEv");
   pragma Import (CPP, Get_Total_Samples_Count, "_ZNK2v814CpuProfileNode20GetTotalSamplesCountEv");
   pragma Import (CPP, Get_Self_Samples_Count, "_ZNK2v814CpuProfileNode19GetSelfSamplesCountEv");
   pragma Import (CPP, Get_Call_Uid, "_ZNK2v814CpuProfileNode10GetCallUidEv");
   pragma Import (CPP, Get_Children_Count, "_ZNK2v814CpuProfileNode16GetChildrenCountEv");
   pragma Import (CPP, Get_Child, "_ZNK2v814CpuProfileNode8GetChildEi");
   pragma Import (CPP, k_No_Line_Number_Info, "_ZN2v814CpuProfileNode17kNoLineNumberInfoE");
end v8.Class_CPU_Profile_Node;
